<!DOCTYPE   html>
<html>
<head>
<meta charset="UTF-8">
<title>
</title>
<script type="text/javascript" src="js/vue-2.6.10.js"></script>
<script type="text/javascript" src="js/axios.js"></script>
<style>
</style>
</head>
<body>
	<form action="/orderSystem/deleteCommodityServlet.do" method="Post" id="app">
       	<input type="hidden" v-model='id' name="id">
        <label   for="id">id：</label>
        <select   id="age"   name="age" v-model="id"  required >
               <option   value="18">1</option>
               <option   value="19">2</option>
               <option   value="20">3</option>
               <option   value="21">4</option>
               <option   value="22">5</option>
               <option   value="23">6</option>
               <option   value="24">7</option>
               <option   value="25">8</option>
               <option   value="26">9</option>
               <option   value="26">10</option>
               <option   value="26">11</option>
               <option   value="26">12</option>
               <option   value="26">13</option>
               <option   value="26">14</option>
               <option   value="26">15</option>
               <option   value="26">16</option>
           </select>
           <label for="gender">性别：</label>
           <input v-if="user.gender=='男'" checked="checked" type="radio"   id="male"   name="gender"   value="男"   required>
           <label for="male">男</label>
           <input v-if="user.gender=='女'" checked="checked"  type="radio"   id="female"   name="gender"   value="女"   required>
           <label for="female">女</label>
           <label for="remark">备注：</label>
           <textarea id="remark" v-model="id.remake"  name="remark"   cols="30"   rows="10"></textarea>
           <input type="submit"   value="完成">
       </form>
       <script type="text/javascript">
	       function parseUrlParams() {
	    	    var url = window.location.href;
	    	    var paramString = url.split('?')[1];
	    	    var paramPairs = paramString.split('&');
	    	    var params = {};
	    	    paramPairs.reduce(function(params, pair) {
	    	        var parts = pair.split('=');
	    	        var key = parts[0];
	    	        var value = decodeURIComponent(parts[1] || '');
	    	        if (params[key]) {
	    	            params[key].push(value);
	    	        } else {
	    	            params[key] = [value];
	    	        }
	    	        return params;
	    	    }, params);
	    	    return params;
	    	}     		
	       let vue = new Vue({
				el: '#app',
				data:{
					id:{
						id: ''
					}
				},
				created(){
					params = parseUrlParams();
					//url: 表示异步请求地址
					axios.get('/orderSystem/deleteCommodityServlet.do?id='+params.id[0]).then(
						function(res_obj){
							//使用获取的数据来给vue对象中的users数据赋值
							vue.user = res_obj.data; 
						}
					).catch(
						function(error_obj){
							alert("网络加载异常！！！");
						}
					)
				}
			});
	</script>
</body>
</html>